#include <iostream>
#include <cstring>
using namespace std;
class car
{
    public:
        //  初始化列表方式初始化数据成员
        car() : price(12.5),weight(51200),maxspeed(150),useyear(6),flag("Benz") {}
        car(car &car);
        car(float price, int wright, int maxspeed, int useyear, string flag);
        //  声明成员函数绑定数据
        void setprice(float price) { this->price = price; }
        float getprice() const { return price; }
        void setweight(int weight) { this->weight = weight; }
        int getweight() const { return weight; }
        void setmaxspeed(int maxspeed) { this->maxspeed = maxspeed; }
        int getmaxspeed() const { return maxspeed; }
        void setuseyear(int useyear) { this->useyear = useyear; }
        int getuseyear() const { return useyear; }
        void setflag(string flag) { this->flag = flag; }
        string getflag() const { return flag; }

    private:  //  私有属性数据成员
        float price;       //  价格，整型，单位（万元）
        int weight;      //  重量，整型，单位（kg)
        int maxspeed;    //  最高时速，整型，单位(km/h)
        int useyear;        //  使用年限，整型，单位（年）
        string flag;     //  车辆品牌，字符型   
};
//  使用汽车类实例化对象
int main()
{
    car *car1 = new car;
    cout << "车辆的价格是" << car1->getprice() << "万元" <<endl;
    cout << "车辆的重量是" << car1->getweight() <<  "kg" <<endl;
    cout << "车辆的最高时速是" << car1->getmaxspeed() << "km/h" <<endl;
    cout << "车辆的使用年限是" << car1->getuseyear() << "年" <<endl;
    cout << "车辆的品牌是" << car1->getflag() <<endl;  
    delete car1;
    car1 = nullptr;
    return 0;
}